package com.qkl.xiatang.app.dto.feed;

import com.qkl.xiatang.app.utils.AppUtils;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@Data
public abstract class FeedAllocAddBaseDTO {

    /**
     * 配料模板id
     */
    private String templateId;

    private List<String> groupIdList;

    private List<String> pondIdList;

    private List<String> taskIdList;

    /**
     * yyyy-MM-dd
     */
    private String time;

    private String memo;

    public boolean checkParams2(){
        groupIdList = AppUtils.stringsDistinct(groupIdList);
        pondIdList = AppUtils.stringsDistinct(pondIdList);
        if(ObjectUtils.isEmpty(groupIdList) && ObjectUtils.isEmpty(pondIdList)){
            return false;
        }
        time = StringUtils.trimToEmpty(time);
        if(StringUtils.isAnyEmpty(time)){
            return false;
        }
        time = AppUtils.toYYYY_MM_DD(time);
        if(!AppUtils.checkYyyyMMdd(time)){
            return false;
        }
        return true;
    }

    public abstract boolean checkParams();

    public abstract List<String> getFeedIds();

}
